<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="Cache-Control" content="no-siteapp" />
         <link rel="stylesheet" href="$meet/static/bootstrap2.3.2/css/bootstrap.min.css">  
         <!-- <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">   -->
         <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
        <!--  <script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script> -->
         <script src="$meet/static/bootstrap2.3.2/js/bootstrap.min.js"></script>
         <script src="$meet/static/bootstrap2.3.2/js/jquery-1.9.1.min.js"></script>
    </head>
<style type="text/css">
thead>tr, tbody>tr {  
                background: #c9e6f6;  
                color: #000;  
            }  
</style>
    <body>
    <nav class="breadcrumb">首页 <span class="c-gray en">&gt;</span> 消息管理 <span class="c-gray en">&gt;</span> 奥运金牌 </nav>
<div class="page-container">
    <div class="cl pd-5 bg-1 bk-gray mt-20"> 
        <span class="l"><a  class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal"> 添加信息</a></span> 
        <!-- 模态框（Modal）开始 -->
                                <div class="modal  fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
                                    <div class="modal-dialog modal-sm" id="myModaldialog">
                                        <div class="modal-content">
                                            <div class="modal-header" >
                                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                                    &times;
                                                </button> 
                                                <h4 class="modal-title" id="myModalLabel">
                                                   获奖情况
                                                </h4>
                                            </div>
                                            <div class="modal-body" >
                                                <form method="post" action="$meet/admin/index/insert_gold">  
                                                             <input type="text"  placeholder="国家" name="name" required="required"  />  <br />
                                                             <input type="text"  placeholder="金牌" name="gold" required="required" /><br />
                                                              <input type="text"  placeholder="银牌" name="silver" required="required" /><br />
                                                             <input type="text"  placeholder="铜牌" name="copper" required="required" /><br/>
                                                              <input type="text"  placeholder="举办年份" name="time" required="required" /><br/>
                                                             <button class="but" type="submit">提交</button>  
                                                </form>
                                            </div>
                                            <div class="modal-footer">
                                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>  
                                            </div>
                                        </div><!-- /.modal-content -->
                                    </div><!-- /.modal -->
                                </div>
                 <!--结束-->
        <span class="r">共有数据：<strong>{$count}</strong> 条</span> 
    </div>
<div class="mt-20">
    <table class="table table-hover" id="cusTable"  
       data-pagination="true"  
       data-show-refresh="true"  
       data-show-toggle="true"  
       data-showColumns="true"> 
        <!-- <caption>table title and/or explanatory text</caption> -->
        <thead>
            <tr>
                <th>国家</th>
                <th>金牌</th>
                <th>银牌</th>
                <th>铜牌</th>
                <th>举办年份</th>
                <td>修改</td>
               
                <td>删除</td>
            </tr>
        </thead>
        <tbody>
        {volist name="list->data" id="vo"}
            <tr>
                <th>{$vo.name}</th>
                <th>{$vo.gold}</th>
                <th>{$vo.silver}</th>
                <th>{$vo.copper}</th>
                <th>{$vo.time}</th>
                <td><a data-target="#{$vo.id}"  data-toggle="modal"><img src='$meet/static/picture/change.png'></a></td>
                 <!-- 模态框（Modal）开始 -->
                            <div class="modal  fade" id="{$vo.id}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
                                <div class="modal-dialog modal-sm" id="myModaldialog">
                                    <div class="modal-content">
                                        <div class="modal-header" >
                                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                                &times;
                                            </button> 
                                            <h4 class="modal-title" id="myModalLabel">
                                               获奖情况:
                                            </h4>
                                        </div>
                                        <div class="modal-body" >
                                         <form method="post" action="$meet/admin/index/update_gold?id={$vo.id}">  
                                         <span>国家：</span><input type="text" required="required" placeholder="国家" name="number" value="{$vo.name}" />  <br />
                                         <span>金牌：</span><input type="text" required="required" placeholder="金牌" name="password" value="{$vo.gold}" /><br />
                                          <span>银牌：</span><input type="text" required="required" placeholder="银牌" name="name" value="{$vo.silver}" /><br />
                                         <span>铜牌：</span><input type="text"  placeholder="铜牌" name="remarks" value="{$vo.copper}" /><br/>
                                         <span>年份：</span><input type="text"  placeholder="年份" name="remarks" value="{$vo.time}" /><br/>
                                         <button class="but" type="submit">提交</button>  
                                        </form>
                                        </div>
                                        <div class="modal-footer">
                                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>  
                                        </div>
                                    </div><!-- /.modal-content -->
                                </div><!-- /.modal -->
                            </div>
                <!--结束-->
                <td><a href="$meet/admin/index/delete_gold?id={$vo.id}"><img src='$meet/static/picture/delete.png'></a></td>
            </tr>
        {/volist}
        </tbody>
    </table>
</div>
    <div style="float: right;">{$list->render}</div>
</div>
    </body>
    <script>
        var mouseStartPoint = {"left":0,"top":  0};  
        var mouseEndPoint = {"left":0,"top":  0};  
        var mouseDragDown = false;  
        var oldP = {"left":0,"top":  0};  
        var moveTartet ;  
        $(document).ready(function(){  
            $(document).on("mousedown","#myModaldialog",function(e){  
                if($(e.target).hasClass("close"))//点关闭按钮不能移动对话框  
                    return;  
                $(".modal").css("overflow", "hidden");//禁止模态对话框的半透明背景滚动
                mouseDragDown = true;  
                moveTartet = $(this).parent();  
                mouseStartPoint = {"left":e.clientX,"top":  e.clientY};  
                oldP = moveTartet.offset(); 
            $(document).on("mouseup",function(e){  
                mouseDragDown = false;  
                moveTartet = undefined;  
                mouseStartPoint = {"left":0,"top":  0};  
                oldP = {"left":0,"top":  0}; 
            });   
            });  
            $(document).on("mousemove",function(e){  
                if(!mouseDragDown || moveTartet == undefined)return;  
                var mousX = e.clientX;  
                var mousY = e.clientY;  
                if(mousX < 0)mousX = 0;  
                if(mousY < 0)mousY = 25;  
                mouseEndPoint = {"left":mousX,"top": mousY};  
                var width = moveTartet.width();  
                var height = moveTartet.height();  
                mouseEndPoint.left = mouseEndPoint.left - (mouseStartPoint.left - oldP.left);//移动修正，更平滑  
                mouseEndPoint.top = mouseEndPoint.top - (mouseStartPoint.top - oldP.top);  
                moveTartet.offset(mouseEndPoint);
            });  
        }); 
       // for(i in document.images)
         //   document.images[i].ondragstart= false;
    </script>
</html>